var windowName = "help";
var Page
apiready = function(){
    onWindowShow(function () {
    })
    onWindowHide(function () {
    })
    console.log("index page is OK");
    Page = createVM("#Page",{
        //页面数据
        pic:picUserHead
    },{
        //页面方法
        "init":function () {
            var data = getLocData("qrCode")
            this.pic = data
        },
        savePic:function (fileName) {
            var _this = this
            if (fileName !== undefined) {
                path = "/storage/emulated/0/qzyt/" + fileName + get_suffix(_this.pic);
            } else {
                path = "/storage/emulated/0/qzyt/" + random_string() + get_suffix(_this.pic);
            }

            api.download({
                url: baseUrl + _this.pic,
                savePath: path
            }, function (ret, err) {
                if (ret.state == 1) {
                    //下载成功
                    api.saveMediaToAlbum({
                        path: ret.savePath
                        ,groupName: 'qzyt'
                    }, function(ret, err) {
                        if (ret && ret.status) {
                            showToast("保存成功");
                        } else {
                            showToast("保存失败");
                        }
                    });
                } else {
                    showToast("资源获取失败")
                }
            });



        }
    })
    Page.init()
}
